<template>
	<view class="container">
		<view>首页</view>
		<view>上传文件测试</view>
		<button type="primary" @click="uploadFile">点击上传文件</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				id:"20181008093"
			}
		},
		
		methods: {
			uploadFile(){
				var _this=this;
				uni.chooseImage({
					success(res) {
						console.log(res)
						var tempFilePath=res.tempFilePaths;
						uni.uploadFile({
							url:'http://localhost:9000/save',
							filePath:tempFilePath[0],
							name:"file",
							formData:{
								"id":_this.id
							},
							
							success(res) {
								console.log(res.data)
							}
						})
					}
				})
			}
		}
	}
</script>

<style>
	.container {
		padding: 20px;
		font-size: 14px;
		line-height: 24px;
	}
</style>
